<?php
	include("config.php");
	include("./dbconfig.php");

	if ($_REQUEST["args"]=="codethatcalendar.html")
	{
		header( 'Location: http://localhost/GMS/library/javascript/calendar/Builder/codethatcalendar.html' ) ;
	}
	//get controller name
	
	if ($_REQUEST["m"]=="" or $_REQUEST["m"]==null)
	{
		$controller_name = "brandsController";
	}
	else
	{ 
		$controller_name 	= $_REQUEST["m"]."Controller";
	}

	//get action name
	if ($_REQUEST["a"]=="" or $_REQUEST["a"]==null)
	{
		$action_name = "IndexAction";
	}
	else 
	{
		$action_name		= $_REQUEST["a"]."Action";
	}
	
	if ($controller_name!="loginController")
	{
		if (!isset($_SESSION['employee']))
		{
			session_start();
			$controller_name = "loginController";
			$action_name	 = "indexAction";
		}
	}
	//include controller file
	include("controller/$controller_name.php");
	
	//create a new instance
	$obj 				= new $controller_name();
	$obj->$action_name();
?>